package com.guonl.config;

import com.guonl.feign.FeignRetryAspect;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.retry.support.RetryTemplate;

/**
 * 方式二: 使用spring-retry
 * 1-开启重试
 */
@EnableRetry
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(RetryTemplate.class)
public class SpringRetryAutoConfiguration {

    @Bean
    public FeignRetryAspect feignRetryAspect() {
        return new FeignRetryAspect();
    }

}
